//
//  ViewController.m
//  simple-code-oc
//
//  Created by iGaven on 2023/12/11.
//

#import "ViewController.h"
#import <pthread.h>
#import "FindMinMaxThread.h"
#import "TableViewController.h"

@interface ViewController ()

@property(nonatomic, strong) NSMutableArray *numbers;
@property(nonatomic, strong) NSMutableSet *threads;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    dispatch_queue_global_t globalQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
//    dispatch_queue_create("test.queue", dispatch_queue_attr_t);
    
    self.threads = [NSMutableSet set];
}

- (IBAction)click:(id)sender {
    
    NSUInteger numberCount = self.numbers.count;
    NSUInteger threadCount = 4;
    for (NSUInteger i = 0; i < threadCount; i++) {
        FindMinMaxThread *thread = [[FindMinMaxThread alloc] initWithNumbers:@[]];
        [self.threads addObject:thread];
        [thread start];
        NSLog(@"######### %p", thread);
    }
    
    NSLog(@"######### %d", self.threads.count);
}

- (IBAction)listClick:(id)sender {
    TableViewController *vc = [[TableViewController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}


@end
